#{extends '/template/main.html' /}
<!-- Removing search and results count filter -->
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">会员卡充值&nbsp;:&nbsp;<font color="red">${webUser.nickName}</font></h3>
        <div class="panel-options">
            <a href="#" data-toggle="panel">
                <span class="collapse-icon">&ndash;</span>
                <span class="expand-icon">+</span>
            </a>
        </div>
    </div>
    <div class="panel-body">
        <button class="btn btn-turquoise" id="searchBtn">充值套餐列表</button>

        <table class="table table-bordered table-striped" id="example-2">
            <tbody class="middle-align">
            <thead>
            <tr>
                <th>充值金额</th>
                <th>赠送金额</th>
                <th>操作</th>
            </tr>
            </thead>
        #{list rechargeComboList,as:'rechargeCombo'}
            <tr>
                <td>${rechargeCombo?.rechargeAmount}</td>
                <td>${rechargeCombo?.giveAmount}</td>
                <td><button class="btn btn-turquoise btn-sm" rechargeAmount="" onclick="toRecharge('${id}','${rechargeCombo?.id}')">确认充值</button></td>
            </tr>
        #{/list}
            </tbody>
        </table>
</div>

<!-- Imported styles on this page -->
<link rel="stylesheet" href="/public/js/datatables/dataTables.bootstrap.css">

<script src="/public/js/datatables/js/jquery.dataTables.min.js"></script>

<!-- Imported scripts on this page -->
<script src="/public/js/datatables/dataTables.bootstrap.js"></script>
<script src="/public/js/datatables/yadcf/jquery.dataTables.yadcf.js"></script>
<script src="/public/js/datatables/tabletools/dataTables.tableTools.min.js"></script>

<script type="text/javascript" src="/public/laypage/laypage.js"></script>
<script type="text/javascript" src="/public/js/echarts/echarts.js"></script>
<script type="text/javascript" src="/public/lib/layer/js/layer.js"></script>
<script type="text/javascript">
    function toRecharge(id , rechargeAmountId) {
        $.getJSON('/BS0017/admin/order/createForUser',{webUserId:id ,rechargeAmountId:rechargeAmountId},function (data) {
            if(data.success){
                layer.msg('充值成功!');
                window.location.href = "/BS0023/admin/order/detail/"+data.orderId+"/1";
            }else {
                layer.msg('充值失败,'+data.msg);
            }
        })
    }
</script>

</div>